Skip to main content

StringPosition

StringPosition["string","sub"] gives a list of the starting and ending character positions at which "sub" appears as a substring of "string". 

StringPosition["string",patt] gives all positions at which substrings matching the general string expression patt appear in "string".

StringPosition["string",patt,n] includes only the first n occurrences of patt.

StringPosition["string",{patt1,patt2,…}] gives positions of all the patti.

StringPosition[{s1,s2,…},p] gives the list of results for each of the si.

StringPosition[patt] represents an operator form of StringPosition that can be applied to an expression.

Please visit the official Wolfram Language Reference for more details and examples on core symbols.